package com.ljlobserv.demo;

import java.util.LinkedList;
import java.util.List;

/**
 * ClassName：Subject
 * Description：观察者模式主题接口
 * Create by Administrator
 * Date：2020/8/25 0025 10:06
 */
public abstract class Subject {
    public List<Observe> observeLinkedListList = new LinkedList<Observe>();
    /**
     * 订阅操作
     * @param observe
     */
    public  void attach(Observe observe){
        observeLinkedListList.add(observe);
    }


    /**
     *  取消订阅操作
     * @param observe
     */
    public void detach(Observe observe){
        observeLinkedListList.remove(observe);
    }

    /**
     * 通知变动
     */
    public abstract void notifyInsert(long uid);

    /**
     * 通知变动
     */
    public abstract void notifyDelete(long uid);


}
